#include "platform.h"
#include "levent.h"

#ifdef CAM_DRYOS  //DryOS

    extern void _set_control_event(int);
    extern void _PB2Rec();
    extern void _Rec2PB();
    int switch_mode_usb(int mode) {
    #ifdef CAM_CHDK_PTP
        if ( mode == 0 ) {
            _Rec2PB();
            _set_control_event(0x80000902); // 0x10A5 ConnectUSBCable
        } else if ( mode == 1 ) {
            _set_control_event(0x902); // 0x10A6 DisconnectUSBCable
            _PB2Rec();
        } else return 0;
        return 1;
    #else
        return 0;
    #endif  //CAM_CHDK_PTP
    }

#else  //VxWorks

    int switch_mode_usb(int mode) {
        if ( mode == 0 ) {
            levent_set_play();
        } else if ( mode == 1 ) {
            levent_set_record();
        } else return 0;
        return 1;
    }

#endif  //CAM_DRYOS
